package stud.aistar.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import stud.aistar.mapper.OrderVoMapper;
import stud.aistar.service.IOrderVoService;
import stud.aistar.vo.NumVo;
import stud.aistar.vo.OrderVo;

import java.util.List;

/**
 * @version 1.0
 * @Auther: GIT:liming  -  jybdd
 * @Description - 本类用于: 个人中心
 * @Date: 2019/9/30 17:43
 */
@Service
@Transactional
public class OrderServiceImpl implements IOrderVoService {

    @Autowired
    private OrderVoMapper orderVoMapper;
    @Override
    public List<OrderVo> findByPid(Integer id) {
        List<OrderVo> orderVo = orderVoMapper.findByPid(id);
        return orderVo;
    }

    @Override
    public PageInfo<OrderVo> findByPid(Integer id, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<OrderVo> orderVos = orderVoMapper.findByPid(id);
        PageInfo<OrderVo> pageInfo = new PageInfo<>(orderVos);
        return pageInfo;
    }

    @Override
    public OrderVo findByOId(Integer id) {
        OrderVo orderVo = orderVoMapper.findByOId(id);
        return orderVo;
    }

    @Override
    public void updateByOId(Integer id) {
        orderVoMapper.updateByOId(id);
    }

    @Override
    public PageInfo<OrderVo> findByPids(Integer id,Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<OrderVo> orderVos = orderVoMapper.findByPids(id);
        PageInfo<OrderVo> pageInfo = new PageInfo<>(orderVos);
        return pageInfo;
    }

    @Override
    public List<OrderVo> findByPids(Integer id) {
                List<OrderVo> orderVos = orderVoMapper.findByPids(id);
                return orderVos;
    }

    @Override
    public List<NumVo> findList(Integer timeId, Integer doctorId) {
        List<NumVo> numVos = orderVoMapper.findList(timeId,doctorId);
        return numVos;
    }
}
